package com.day.controller;

import com.day.mapper.ClassesMapper;
import com.day.pojo.Classes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/classes")
public class ClassesController {

    @Autowired
    ClassesMapper classesMapper;

    @RequestMapping("/getClassesList")
    public List<Classes> getClassesList() {
        return classesMapper.getClassesList();
    }
    @RequestMapping("/getClassesById")
    public String getClassesById(Integer c_id){
        classesMapper.getClassesById(c_id);
        return "查询单个班级";
    }
    @RequestMapping("/addClasses")
    public String addClasses(Classes classes){
        classesMapper.addClasses(classes);
        return "添加班级成功";
    }
    @RequestMapping("/delClassesById")
    public String delClassesById(Integer c_id){
        classesMapper.delClassesById(c_id);
        return "删除班级成功";
    }
    @RequestMapping("/editClassesById")
    public String editClassesById(Classes classes){
        classesMapper.editClassesById(classes);
        return "修改班级成功";
    }
}
